package com.tedu.bill.demo1;

/**
 * Author：毕龙
 * Date: 2024/5/9 19:16
 */
public class TestObjectMethod {
    public static void main(String[] args) {
        //getClass 返回一个类的类型
        //instanceof
        System.out.println(new Teacher().getClass());
        Teacher t1 = new Teacher();
        Teacher t2 = new Teacher();
        System.out.println(t1.getClass() == t2.getClass());
        //返回对象的哈希值
        System.out.println(t1.hashCode());
        System.out.println("16进制的hash值："+Integer.toHexString(t1.hashCode()));
        System.out.println(t2.hashCode()); //toString
        //获取的是一个对象的getClass + "@"+ hashcode
        System.out.println(t1.toString());
        System.out.println(t2.toString());
        System.out.println(t1);
        System.out.println(t2);
        //判断两个对象的地址是否相同
        //判断两个对象的toString 是否相同
        System.out.println(t1 == t2);

        System.out.println(Integer.hashCode(1));

        String s1 = "hello";
        System.out.println(s1.hashCode());


    }
}
